package com.example.recruitment_website.controller;

import com.example.recruitment_website.domain.Record;
import com.example.recruitment_website.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("Record")
public class RecordController {
    @Autowired
    RecordService recordService;

    @GetMapping("/addRecord")
    public HashMap addRecord(int id, int userId){
        recordService.addRecord(id,userId);
        HashMap<String,Object> map = new HashMap<>();
        map.put("msg","添加成功");
        map.put("code",1);
        return map;
    }

    @GetMapping("/findRecordById")
    public HashMap findRecordById(int userId){
        List<Record> list = recordService.findAllRecordById(userId);
        HashMap<String,Object> map = new HashMap<>();
        map.put("msg","添加成功");
        map.put("data",list);
        map.put("code",1);
        return map;
    }


}
